package com.matt.foundation.vo.course;

import com.matt.domain.course.CoursePlan;
import com.matt.foundation.DO.AdviseDetailDO;
import lombok.Data;

import java.util.List;
import java.util.stream.Collectors;

/**
 * *******************************
 * Created by Ron.
 * form com.matt
 * on 2018/1/25
 * *******************************
 */
@Data
public class WebPrepareDetailVo {
    private String coursePlanId;
    private Long courseDate;
    private Long beginTime;
    private Long endTime;
    private Integer courseType;
    private String typeName;
    private String title;
    private String content;
    private List<AdviseDetailDO> adviseList;
    private List<String> childrenNames;

    public static WebPrepareDetailVo of(CoursePlan coursePlan, List<AdviseDetailDO> adviseList, List<Object[]> childrens){
        WebPrepareDetailVo vo = new WebPrepareDetailVo();
        vo.setCoursePlanId(coursePlan.getId());
        vo.setCourseDate(coursePlan.getCourseDate().getTime());
        vo.setBeginTime(coursePlan.getBeginTime().getTime());
        vo.setEndTime(coursePlan.getEndTime().getTime());
        vo.setCourseType(coursePlan.getCourseType());
        vo.setTypeName(coursePlan.getTypeName());
        vo.setTitle(coursePlan.getCourseName());
        vo.setAdviseList(adviseList);
        vo.setChildrenNames(childrens.stream().map(o->o[1].toString()).collect(Collectors.toList()));
        return vo;
    }
}
